
using Mengsk.ProxyDelivery.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.Service
{
    public class SmsHistoryService : ServiceBase<SmsHistory>
    {

        private const string APIURL_MODIFYTIME = "/webservice/sms/modifytime.html";

        public DataCollection<SmsHistory> GetByAll(SmsHistoryType type, int targetType, int targetId, string content, DateTime createTime, DateTime endTime, int hasUsed, int pageIndex, int pageSize)
        {
            Request req = new Request { Api = "getByAll" };
            req.Add("type", type);
            req.Add("targetType", targetType);
            req.Add("targetId", targetId);
            req.Add("conent", content);
            req.Add("createTime", this.FormatToDBTime(createTime));
            req.Add("endTime", this.FormatToDBTime(endTime));
            req.Add("hasUsed", hasUsed);
            req.Add("pageIndex", pageIndex);
            req.Add("pageSize", pageSize);

            return this.DoRemoteCall<SmsHistory>(req).ToDataCollection();
        }

        public void ModifyTime(int id, DateTime createTime, DateTime endTime)
        {
            Dictionary<string, string> para = new Dictionary<string, string>();
            para.Add("id", id.ToString());
            para.Add("startTime", this.FormatTime(createTime));
            para.Add("endTime", this.FormatTime(endTime));
            this.DoPost<int>(APIURL_MODIFYTIME, para);
        }

    }
}